package com.zhipin.hackthon;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;


public class Main {

    public static void main(String[] args) {
        //示例1
        Rights rightA = new Rights("权益A",Stream.of("北京", "上海", "天津").collect(Collectors.toSet()), 4);
        Rights rightB = new Rights("权益B",Stream.of("上海", "杭州", "广州").collect(Collectors.toSet()), 2);
        //用户的权益列表
        List<Rights> rightsList = Stream.of(rightA,rightB).collect(Collectors.toList());
        User user = new User(rightsList);

        //模拟用户依次顺序发布城市职位
        List<String> cityList = Stream.of("北京", "北京", "北京", "上海", "天津").collect(Collectors.toList());
        for (String city : cityList) {
            boolean res = user.publishJob(city);
            if (!res) {
                System.out.println("user publish city:" + city + " failed");
                break;
            }
        }

        // 获取权益占用结果列表
        List<RightsUse> rightsUseList = user.getRightsUseList();
        System.out.println(rightsUseList);
        //示例的结果
        //("北京"，"权益A"), ("北京"，"权益A"), ("北京"，"权益A"), ("上海"，"权益B"), ("天津"，"权益A")
    }
}
